<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" value="免费发送验证码" id="btn" onclick="settime(this)">

</body>
</html>
<script>
    var time=60;
    function settime(btn) {
        if(time==0){
            btn.setAttribute("disable");
            btn.value="免费获取验证码"
            time=60;
            btn.val(time);
        }else {
            btn.setAttribute("disabled", true);
            btn.value="重新发送(" + time + ")"
            time--;
        }
        setTimeout(function() {
            settime(btn)
        },1000)
    }
</script>